package com.ncu.cloundeoffice.service.impl;

import com.ncu.cloundeoffice.mapper.TRoleMapper;
import com.ncu.cloundeoffice.pojo.TRole;
import com.ncu.cloundeoffice.service.TRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TRoleServiceImpl implements TRoleService {

    @Autowired
    private TRoleMapper tRoleMapper;
    /**
     * 通过登录用户的id查询该用户的角色
     * @param adminId
     * @return
     */
    @Override
    public List<TRole> getTRoleByAdminId(int adminId) {
        return tRoleMapper.getTRoleByAdminId(adminId);
    }

    /**
     * 查询所有角色
     * @return
     */
    @Override
    public List<TRole> getAllTRole() {
        return tRoleMapper.getAllTRole();
    }

    /**
     * 删除角色
     * @param id
     * @return
     */
    @Override
    public int deleteTRole(int id) {
        return tRoleMapper.deleteTRole(id);
    }

    /**
     * 添加角色
     * @param tRole
     * @return
     */
    @Override
    public int addTRole(TRole tRole) {
        return tRoleMapper.addTRole(tRole);
    }
}
